// 带时间的显隐，控制长度，利用溢出隐藏
var length_time = function(a,b,c,d){
	var sjxy = 0;
	// 显示函数
	var display = function(){
		b.style.display='block';
		function time_(n){
			setTimeout(function() {
				if(n<=c){
				    b.style.height = n+'px';
				    time_(n+1);
				    sjxy=n;
				}
			}, d);
		}
		time_(sjxy);
	}
	// 隐藏函数
	var hide = function(){
		function time_(n){
			setTimeout(function() {
				if(n>=0){
				    b.style.height = n+'px';
				    time_(n-1);
				    sjxy = n;
				}else if(n<0){
					b.style.display='none';
				}
			}, d);
		}
		time_(sjxy);
	}
	a.addEventListener("mouseover",function(){
		display();
	});
	a.addEventListener("mouseleave",function(){
		hide();
	})
}

var length_notime = function(a,b){
	a.addEventListener("mouseover",function(){
		b.style.display='block';
	});
	a.addEventListener("mouseleave",function(){
		b.style.display='none';
	})
}
var length_mobile = function(a,b){
	a.onclick = function(){
		b.style.height='100%';
	};
	a.addEventListener("mouseleave",function(){
		b.style.height='0';
	})
}
// 显隐函数的调用，开始，最后改成数组
var arr1 = ['.language','.group','.li-2','.li-3','.li-2-1','.li-2-2','.li-2-3','.li-2-4','.li-2-5','.li-2-6','.li-2-7','.li-2-8','.li-4','.li-3-1','.li-5','.li-4-1','.li-4-2','.li-6','.li-7','.li-6-1','.li-6-2','.li-right','.li-7-1'];
var arr2 = ['.language-hide','.group-hide','.li-1-hide','.li-2-hide','.li-2-1-hide','.li-2-2-hide','.li-2-3-hide','.li-2-4-hide','.li-2-5-hide','.li-2-6-hide','.li-2-7-hide','.li-2-8-hide','.li-3-hide','.li-3-1-hide','.li-4-hide','.li-4-1-hide','.li-4-2-hide','.li-5-hide','.li-6-hide','.li-6-1-hide','.li-6-2-hide','.li-7-hide','.li-7-1-hide'];
for(var i = 0;i<arr1.length;i++){
	if (i==0) {
		length_time(document.querySelector(arr1[i]),document.querySelector(arr2[i]),55,5);
	}else if (i==1) {
		length_time(document.querySelector(arr1[i]),document.querySelector(arr2[i]),170,1);
	}else if(window.screen.width>860){
		length_notime(document.querySelector(arr1[i]),document.querySelector(arr2[i]));
	}else if (window.screen.width<860) {
		length_mobile(document.querySelector(arr1[i]),document.querySelector(arr2[i]));
	}
}
// 显隐函数的调用，结束
// 轮播
 var swiper = new Swiper('.swiper-container', {
 		  // 左右切换
 		  navigation: {
		      nextEl: '.swiper-button-next',
		      prevEl: '.swiper-button-prev',
		  },
	      // 无限循环
	      slidesPerView: 1,
	      spaceBetween: 0,
	      loop: true,
	      // 下面小点
	      pagination: {
	        el: '.swiper-pagination',
	        clickable: true,
	      },
	      // 滚动动画时间
	      speed:1000,
	      // 滚动间隔时间
	      autoplay: {
	        delay: 4500,
	        disableOnInteraction: false,
	      },
});
 // 轮播结束
 // 回到头部
 fhtb.onclick = function(){
		function top_(n){
			setTimeout(function() {
				if(n>=-100){
					window.scrollTo({
						top:n,
						behavior:'smooth'
					})
				    top_(n-100);
				}
			}, 1);
		}
		top_(document.documentElement.scrollTop)
 }
window.onscroll = function(){
	if(document.documentElement.scrollTop > 500||document.body.scrollTop>500){
		fhtb.style.display="block";
	}else{
		fhtb.style.display="none";
	}
}
 // 回到头部


// 响应式
var mobile_sosuo = 0;
sosuo2_click.onclick = function(){
	if (mobile_sosuo == 0) {
		sosuo2_hide.style.display="block";
		function mobile_ss(n){
			setTimeout(function() {
				if(n<=1){
				    sosuo2_hide.style.opacity = n;
				    mobile_ss(n+0.01);
				}
			}, 1);
		}
		mobile_ss(0);
		mobile_sosuo = 2;
	}else if (mobile_sosuo == 2) {
		function mobile_ssy(n){
			setTimeout(function() {
				if(n>=0){
				    sosuo2_hide.style.opacity = n;
				    mobile_ssy(n-0.01);
				}else{
					sosuo2_hide.style.display="none";
				}
			}, 1);
		}
		mobile_ssy(1);
		mobile_sosuo = 0;
	}
}
var Navigation = 0;


// 三
Navigation_clock.onclick = function(){
	if (Navigation==0) {
		Navigation_clock.style.background="#015198 url(images/yidongduan/chahao.png) no-repeat";
		function bootom_zths(n){
			setTimeout(function() {
				if(n<370&&n>=0){
				    bootom_zhuti.style.height = n+'px';
				    bootom_zths(n+5);
				}if(n>=365){
					bootom_zhuti.style.overflow = 'inherit';
				}
			}, 1);
		}
		bootom_zths(0);
		Navigation = 1;
		console.log(1);
	}else{
		Navigation_clock.style.background="#015198 url(images/yidongduan/san.png) no-repeat";
		function bootom_zths(n){
			setTimeout(function() {
				if(n<=370&&n>=0){
					bootom_zhuti.style.overflow = 'hidden';
				    bootom_zhuti.style.height = n+'px';
				    bootom_zths(n-5);
				}
			}, 1);
		}
		bootom_zths(370);
		Navigation = 0;
		console.log(21);
	}
}



// V
var headerMobileSpan = document.querySelectorAll('.bottom li span');
for(var f = 0;f <headerMobileSpan.length;f++){
	headerMobileSpan[f].onclick = function(){
		for(var q = 0;q <headerMobileSpan.length;q++){
			headerMobileSpan[q].style.background='url(images/xysV.png) no-repeat center center';
		}
		this.style.background='url(images/xysA.png) no-repeat center center';
		// this.parentNode.previousSibling.style.background='url(../images/xysA.png) no-repeat center center';
	}
}

// 宽度window.screen.width  ----var g = a.lastChild;获取a的最后一个子节点
// 
// footer
var footerMobileLi = document.querySelectorAll('footer li');
for(var fml = 0;fml<footerMobileLi.length; fml++){
	footerMobileLi[fml].onclick = function(){
		for(var fml_n = 0;fml_n <footerMobileLi.length;fml_n++){
			footerMobileLi[fml_n].setAttribute("class", "");
		}
		this.setAttribute("class", "mobileli");
		// .classList.add("mobileli");
	}
}




